package com.px.service;


import com.px.client.ShCommodityFeignClient;
import com.px.pojo.ShCommodity;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class ShCommodityServiceImpl implements ShCommodityService {

    @Resource
    private ShCommodityFeignClient shCommodityFeignClient;

    @Override
    public List<ShCommodity> selectShCommodityList(String commodityName, Integer dicOneId, Integer dicTwoId, Double minPrice, Double maxPrice, String ram, Integer currentPageNo, Integer pageSize) throws Exception {
        Integer offSet = (currentPageNo-1)*pageSize;
        return shCommodityFeignClient.selectShCommodityList(commodityName,dicOneId,dicTwoId,minPrice,maxPrice,ram,offSet,pageSize);
    }

    @Override
    public int selectShCommodityCount(String commodityName, Integer dicOneId, Integer dicTwoId, Double minPrice, Double maxPrice, String ram) throws Exception {
        return shCommodityFeignClient.selectShCommodityCount(commodityName,dicOneId,dicTwoId,minPrice,maxPrice,ram);
    }

    @Override
    public ShCommodity selectShCommodity(Integer commodityId) throws Exception {
        return shCommodityFeignClient.selectShCommodity(commodityId);
    }

    @Override
    public int insertShCommodity(ShCommodity shCommodity) throws Exception {
        return shCommodityFeignClient.insertShCommodity(shCommodity);
    }

    @Override
    public int updateShCommodity(ShCommodity shCommodity) throws Exception {
        return shCommodityFeignClient.updateShCommodity(shCommodity);
    }

    @Override
    public int deleteShCommodity(Integer id) throws Exception {
        return shCommodityFeignClient.deleteShCommodity(id);
    }
}
